#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time      :2022/6/2 14:58
# @Author    :cjw
import allure
from appium.webdriver.common.appiumby import AppiumBy

from app_wework.base.base_page import BasePage
from app_wework.util.log import logger


class AddMemberPage(BasePage):
	"""添加成员页面"""

	__BTN_EDIT_MEMBER_BY_MANUAL = (AppiumBy.XPATH, '//*[@text="手动输入添加"]')  # 手动输入添加

	def goto_edit_member_by_manual(self):
		"""手动输入添加，跳转到添加成员页面"""
		from app_wework.page.edit_member_page import EditMemberPage

		with allure.step(msg := '点击“手动输入添加”，跳转到添加成员页面'):
			logger.info(msg)
			self.find_click(self.__BTN_EDIT_MEMBER_BY_MANUAL)
		return EditMemberPage(self.driver)

	def find_toast_text(self) -> str:
		"""获取新增成员成功的toast文本"""
		tip_text = self.toast_text
		with allure.step(msg := f'获取toast提示信息：{tip_text}'):
			logger.info(msg)
		return tip_text
